#region Using

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Runtime.Serialization;
using System.Text;
using Bronze.ReportBuilder.Toolbox.Controls;
using Gizmox.WebGUI.Common;
using Gizmox.WebGUI.Common.Resources;
using Gizmox.WebGUI.Forms;

#endregion

namespace Bronze.ReportBuilder
{
    [Serializable]
    public partial class ControlLabel : UserControl
    {
        public ControlLabel()
        {
            InitializeComponent();
        }

        public ControlLabel(IToolboxItem toolboxItem)
        {
            InitializeComponent();
            this.ToolboxItem = toolboxItem;
            this.Label = toolboxItem.ControlName;
            this.ControlImage = toolboxItem.Icon;
        }

        public IToolboxItem ToolboxItem { get; set; }

        

        private static SerializableProperty ControlImageProperty = SerializableProperty.Register("ControlImage", typeof(ResourceHandle), typeof(ControlLabel));

        [Localizable(true), Bindable(true), Category("CatAppearance"), DefaultValue(null)]
        public ResourceHandle ControlImage
        {
            get
            {
                return this.GetValue<ResourceHandle>(ControlLabel.ControlImageProperty, null);
            }
            set
            {
                if (this.ControlImage != value)
                {
                    if (value != null)
                    {
                        this.SetValue<ResourceHandle>(ControlLabel.ControlImageProperty, value);
                    }
                    else
                    {
                        this.RemoveValue<ResourceHandle>(ControlLabel.ControlImageProperty);
                    }
                    this.pictureBox1.Image = value;
                    Update();
                }


            }
        }

        public string Label
        {
            get { return label; }
            set
            {
                label = value;
                this.label1.Text = label;
                Update();
            }
        }

        private string label;

        private void label1_Click(object sender, EventArgs e)
        {

        }

       
    }
}